import argparse

def get_args(time_steps, n_rois) -> argparse.ArgumentParser:
    parser = argparse.ArgumentParser()
    
    parser.add_argument('--AD_dir', type=str, default="AD/", help="the path to AD folder")
    parser.add_argument('--CN_dir', type=str, default="CN/", help="the path to CN folder")
    parser.add_argument('--train_root_path', type=str, default="/home/sakura/Downloads/python/Altheimer_datasets/datafc90minblan4/train", help="the path to trainingsets")
    parser.add_argument('--val_root_path', type=str, default="/home/sakura/Downloads/python/Altheimer_datasets/datafc90minblan4/val", help="the path to validationsets")
    parser.add_argument('--test_root_path', type=str, default="/home/sakura/Downloads/python/Altheimer_datasets/datafc90minblan4/test", help="the path to testsets")
    
    # parameters for model construction
    parser.add_argument('--n_rois', type=int, default=n_rois, help="number of roi")
    parser.add_argument('--time_steps', type=int, default=time_steps, help="number of sliding windows")
    parser.add_argument('--n_classes', type=int, default=2, help="number of classes")
    parser.add_argument('--epochs', type=int, default=200, help="number of epochs")
    parser.add_argument('--n_channels', type=int, default=1, help="number of channel")
    parser.add_argument('--batch_size', type=int, default=16, help="batch size")
    parser.add_argument('--dropout_rate', type=float, default=0.25, help="dropout rate")
    parser.add_argument('--lstm_uints', type=int, default=64, help="number of lstm uints")
    parser.add_argument('--kernel_sizes', type=list, default=[(2, n_rois, 1), (2, 1, n_rois), (8, 1, 1)], help="3D kernel size")
    parser.add_argument('--n_conv_filters', type=list, default=[8, 16, 32], help="number of filters")
    parser.add_argument('--stride_sizes', type=list, default=[(1, 1, 1), (1, 1, 1), (2, 1, 1)], help="stride length for each convolution")
    
    # optimal configuration
    parser.add_argument('--mode', type=str, default='min', help="save mode for checkpoint")
    parser.add_argument('--model_saving_path', type=str, default="/home/sakura/Downloads/python/Altheimer_datasets/best.keras", help="path to model saving")
    parser.add_argument('--monitor', type=str, default='loss', help='Metric to monitor')
    parser.add_argument('--factor', type=int, default=0.1, help="the factor of reducing learning rate")
    parser.add_argument('--early_stopping_monitor', type=str, default='val_loss', help="monitor metric config for early stopping")
    parser.add_argument('--early_stopping_patience', type=int, default=15, help="Number of epochs with no improvement after which training will be stopped")
    parser.add_argument('--lr_patience', type=int, default=10, help= "Number of epochs with no improvement after which learbing_rate will decrease")
    parser.add_argument('--min_lr', type=int, default=1e-7, help="the minimal learning rate when training")
    parser.add_argument('--verbose', type=int, default=1, help="turn on the verbose output when training")
    parser.add_argument('--steps_per_epoch', type=int, default=max(1,time_steps//16), help="settting a approriate the steps_per_epoch")
    parser.add_argument('--class_weight', type=str, default="balanced", help="balance the class weight")
    return parser.parse_args()